<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<title>${setting.siteName}-编辑文章表</title>
<meta name="keywords" content="${setting.siteName}">
<meta name="description" content="${setting.siteName}">
<!-- BEGIN HEADER -->
[#include "/admin/include/style.ftl"]
<!-- END HEADER -->
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content  animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>编辑文章表</h5>
						<div class="ibox-tools">
							<button type="button" class="btn btn-outline btn-white btn-xs"
								id="btn-return-loippi"
								onclick="location.href='${base}/admin/article/list.jhtml'">
								<i class="fa fa-reply-all"></i> 返回列表
							</button>
						</div>
					</div>
					<div class="ibox-content">
						<form id="inputForm" class="form-horizontal"
							action="${base}/admin/article/update.jhtml" method="post">
							<input type="hidden" value="${systemArticle.id}" name="id" /> <input
								type="hidden" name="type" class="form-control" maxlength="200"
								value="${(systemArticle.type)!''}" />
							<div class="form-group">
								<div class="row">
									<div class="col-sm-6">
										<label class="col-sm-3 control-label">标题内容</label>
										<div class="col-sm-9">
											<input type="text" name="title" class="form-control"
												maxlength="200" value="${(systemArticle.title)!''}" />
										</div>
									</div>
								</div>
							</div>
							<!--/row-->
							<div class="form-group">
								<div class="row">
									<div class="col-sm-12">
                                        <label class="col-sm-3 control-label">封面图片<br/><span style="color: #3b3999; font-size: 11px">图片规格200*200</span></label>
										<div class="col-sm-9">
											<img id="image" src="${(systemArticle.image)!''}"
												style="width: 200px; height: 200px;"></img> 
											<input type="hidden" name="image" id="imageInput"
												class="form-control" />
											<div class="upload">
												<label id="uploadCut">上传<input type="file"
													id="fileCut" /></label>
											</div>
											[#--<input type="button" id="uploadBtn" style="top: 200px"
												class="btn btn-warning" value="修改" />--]
										</div>
									</div>
								</div>
							</div>

							<div class="form-group">
								<div class="row">
									<div class="col-sm-6">
										<label class="col-sm-3 control-label">排序数字</label>
										<div class="col-sm-9">
											<input type="text" name="articleCategoryId"
												class="form-control" maxlength="200"
												value="${(systemArticle.articleCategoryId)!''}" />
										</div>
									</div>
								</div>
							</div>
							<!--/row-->

							<div class="form-group">
								<div class="row">
									<div class="col-sm-6">
										<label class="col-sm-3 control-label">创建者</label>
										<div class="col-sm-9">
											<input type="text" name="creator" class="form-control"
												maxlength="200" value="${(systemArticle.creator)!''}" />
										</div>
									</div>
								</div>
							</div>
							<!--/row-->

							<div class="form-group">
								<div class="row">
									<div class="col-sm-6">
										<label class="col-sm-3 control-label">图文详情</label>
										<div class="col-sm-9">
											<textarea id="editor" name="content" class="editor">${(systemArticle.content)!''}</textarea>
										</div>
									</div>
								</div>
							</div>

							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<div class="col-sm-12 col-sm-offset-10">
									<button type="button" class="btn btn-default"
										onclick="window.history.back();">返回</button>
									<button class="btn btn-success" type="submit">保存内容</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- BEGIN Script -->
	[#include "/admin/include/script.ftl"]
	<!-- END Script -->
	<script>
    
    $(document).ready(function () {
    	[@flash_message /]
    	$(".chosen-select").chosen({width:"100%"}); 
    	$(".input-daterange").datepicker({keyboardNavigation:false,forceParse:false,autoclose:true});
    	
    	$(".browserButton").browser({callback:function(url){
			$("#"+$(this).attr('for')).val(url);
		}});
    	
		$(".input-group.date").datepicker({todayBtn:"linked",keyboardNavigation:false,forceParse:false,calendarWeeks:true,autoclose:true});
    	$("#inputForm").validate({
           rules: {
            },
            messages: {
			}
        });
    	
    	//封面图
        $('#uploadCut').on('change',function(){
       	 var formData = new FormData();
            var img_file = document.getElementById("fileCut");
    		var fileObj = img_file.files[0];
    		formData.append("file",fileObj);
    		formData.append("fileType","image");
    		$.ajax({
   			url:'${base}/admin/file/upload.jhtml',
   			type:'POST',
   			data:formData,
   			async:false,
   			processData:false,
   			contentType:false,
   			success:function(data){
   				data=JSON.parse(data);
   				$("#image").show();
   				$("#image").attr("src",data.url);
   				$("#imageInput").val(data.url);
   				$('#uploadBtn').val("修改")
   			}
        });
        });
		
    });
    </script>
</body>
</html>
